import React, { Component, Suspense } from 'react';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';

import { connect } from 'dva';
import PageLoading from '@/components/PageLoading';
import { FormattedMessage } from 'umi-plugin-react/locale';
import { Form, Tabs } from 'antd';
import UnknownProblem from './UnknownProblem'; 
import OpenQuestion from './OpenQuestion';
import ManualProblem from './ManualProblem'
import styles from "./index.less";

const TabPane = Tabs.TabPane
const FormItem = Form.Item;
@connect(({ process, loading }) => ({
  process,
  loading: loading.effects['waitingLearningIssue/fetch'],
}))

class WaitingLearningIssue extends Component {
  constructor(props) {
    super(props);
    this.state = {
      a:0,
      b:0,
      c:0,
      id:this.props.location.params !== undefined ?  '2':'1'
    };
  }

  componentDidMount() {
  }

  

  callback=(key)=>{
    console.log(key);
  }

  totala=(a)=>{
    this.setState({a,})
  }

  totalb=(b)=>{
    this.setState({b,})
  }

  totalc=(c)=>{
    this.setState({c,})
  }


  render() {
    return (
      <Suspense fallback={<PageLoading />}>
        <PageHeaderWrapper>
          <div className={styles.backgroundp}>
              <div className='tabYs'>
              <Tabs   defaultActiveKey={this.state.id} onChange={this.callback}>
                <TabPane forceRender={true} tab={<span>未知问题{`(${this.state.a})`}</span>} key="1">
                  <UnknownProblem totala={this.totala} />
                </TabPane>
                <TabPane forceRender={true} tab={<span>未解决问题{`(${this.state.b})`}</span>} key="2">
                  <OpenQuestion totalb={this.totalb} />
                </TabPane>
                {/* <TabPane forceRender={true} tab={<span>转人工问题{`(${this.state.c})`}</span>} key="3">
                  <ManualProblem totalc={this.totalc}></ManualProblem>
                </TabPane> */}
              </Tabs>
              </div>
          </div>
        </PageHeaderWrapper>
      </Suspense>
    );
  }
}
export default connect(({ user }) => ({ // 全局数据
  currentUser: user.currentUser,
}))(Form.create()(WaitingLearningIssue));